package com.liyuhan.onlinetaxibackground.Controller;

import com.liyuhan.onlinetaxibackground.Service.CommentService;
import com.liyuhan.onlinetaxibackground.dto.DataResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @RequestMapping("/doComment")
    public DataResponse doComment(@Valid @RequestBody String request) {
        // 提交评论-评论内容、星级、用户类型、订单号
        return commentService.doComment(request);
    }

    @RequestMapping("/getComments")
    public DataResponse getComments(@Valid @RequestBody String request) {
        // 根据订单号获取绑定的评论
        return commentService.getComments(request);
    }
}
